package cn.edu.nju.askme.action;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.struts2.interceptor.SessionAware;
import org.springframework.stereotype.Component;

import cn.edu.nju.askme.model.Paper;
import cn.edu.nju.askme.model.User;
import cn.edu.nju.askme.service.IPaperService;

import com.opensymphony.xwork2.ActionSupport;

@Component
public class PaperListAction extends ActionSupport implements SessionAware{
	private IPaperService paperService;
	private List<Paper> paperList;
	private Map session;
	public IPaperService getPaperService() {
		return paperService;
	}
	@Resource
	public void setPaperService(IPaperService paperService) {
		this.paperService = paperService;
	}
	public Map getSession() {
		return session;
	}
	public void setSession(Map session) {
		this.session = session;
	}
	
	public List<Paper> getPaperList() {
		return paperList;
	}
	public void setPaperList(List<Paper> paperList) {
		this.paperList = paperList;
	}
	@Override
	public String execute() throws Exception {
		paperList = paperService.checkByCreator((User)session.get("user"));
		return SUCCESS;
	}
}
